<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var time = new Date()

    console.log( time.getFullYear() )  // 年
    console.log( time.getMonth() + 1 )  // 月
    console.log( time.getDate() )  // 日

    var arr = ['星期日', '星期一', '星期二']
    console.log( arr[ time.getDay() ] ) 

    var str = time.getFullYear() + '-' + (time.getMonth() + 1 + '').padStart(2, 0) + '-' + time.getDate() + ' ' + arr[ time.getDay() ] 
    
    console.log(str)
  </script>
</body>
</html>